﻿using Microsoft.AspNetCore.Http;

namespace SJ.Platform.Extend.IOC.CurrentUser
{
    public class CurrentUser : ICurrentUser, IDependency
    {
        private readonly IHttpContextAccessor _httpContextAccessor;

        public CurrentUser(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }

        public string UserId => _httpContextAccessor.HttpContext?.User.FindFirst("UserId")?.Value;
        public string RealName => _httpContextAccessor.HttpContext?.User.FindFirst("RealName")?.Value;
    }
}